Skip to content

fix: enhance error handling in appendToolCallStatus method#145

Merged
ethanyhou merged 4 commits into
mainfrom
cs/error-label
May 9, 2026
Merged

fix: enhance error handling in appendToolCallStatus method#145
ethanyhou merged 4 commits into
mainfrom
cs/error-label

Conversation

@jdneo
Copy link
Copy Markdown
Member

@jdneo jdneo commented May 7, 2026

image

Copilot AI review requested due to automatic review settings May 7, 2026 08:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves agent tool-call status rendering in the chat UI by ensuring error tool-call updates display meaningful text (preferring toolCall.error and falling back to progressMessage), and adds UI tests to validate the behavior.

Changes:

  • Relaxed the early-return guard in BaseTurnWidget.appendToolCallStatus to allow processing error-only tool-call updates.
  • Updated error status handling to set the status label text from toolCall.error (fallback to progressMessage).
  • Added a new UI test suite covering multiple error status scenarios and overwrite behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/BaseTurnWidget.java Adjusts tool-call status rendering to handle error-only updates and display error text reliably.
com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/BaseTurnWidgetToolCallStatusTest.java Adds regression tests verifying error-status text rendering and replacement behavior.

jdneo and others added 2 commits May 8, 2026 11:25
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/BaseTurnWidget.java:245

  • appendToolCallStatus now correctly prefers a non-blank error message for top-level tool calls, but the run_subagent path still uses different fallback logic inside handleSubagentToolCall (it checks StringUtils.isNotEmpty(toolCall.getError()) and unconditionally sets that as text). This means a whitespace-only error can still override a valid progressMessage and render as empty text for subagent failures. Consider aligning handleSubagentToolCall with the new isNotBlank/fallback behavior (and ideally sharing the same helper) so error text rendering is consistent for subagent and non-subagent tool calls.
    String status = toolCall.getStatus().toLowerCase();
    // Require a non-blank progressMessage for non-error events. For error events,
    // also accept a non-blank `error` field as the displayable text.
    boolean isError = "error".equals(status);
    if (StringUtils.isBlank(toolCall.getProgressMessage())
        && (!isError || StringUtils.isBlank(toolCall.getError()))) {
      return;
    }

    // Check if this is a run_subagent tool call
    if ("run_subagent".equalsIgnoreCase(toolCall.getName())) {
      handleSubagentToolCall(toolCall);
      return;

@xinyi-gong
Copy link
Copy Markdown
Member

Currently the user sees a error message without knowing which tool failed, which makes it harder to understand what went wrong. Since toolCall.getName() is available, it might be worth prefixing the error message with it.
image

@jdneo
Copy link
Copy Markdown
Member Author

jdneo commented May 9, 2026

Currently the user sees a error message without knowing which tool failed, which makes it harder to understand what went wrong. Since toolCall.getName() is available, it might be worth prefixing the error message with it. image

Fixed in 5bc2a76

Copy link
Copy Markdown
Member

@xinyi-gong xinyi-gong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ethanyhou ethanyhou merged commit 49f0123 into main May 9, 2026
4 checks passed
@ethanyhou ethanyhou deleted the cs/error-label branch May 9, 2026 09:01
@jdneo jdneo mentioned this pull request May 18, 2026
37 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants